package app.controller;
// 登录控制器

import app.service.LoginService;
import cn.hutool.core.lang.Console;
import com.alibaba.fastjson.JSONObject;
import com.sun.istack.internal.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.websocket.server.PathParam;

@RestController
@RequestMapping(value = "user", method = RequestMethod.POST)
public class LoginController {
    @Autowired
    private LoginService service;

    @PostMapping("login")
    public JSONObject login(@PathParam("username") String username, @PathParam("password") String password) {
        return service.login(username, password);
    }

    @PostMapping("verity")
    public synchronized JSONObject verityToken(@NotNull @CookieValue("token") String token) {
        Console.log("token\t:", token);
        return null;
    }
}
